/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import util.enumeration.ActivityType;

/**
 *
 * @author KohLi
 */
@Entity(name="Event")
public class EventEntity extends ActivityEntity implements Serializable {
    private static final long serialVersionUID = 1L;
   
    private String eventName;
    private String eventDesc; 
    private String eventUrl; 
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date creationDate; 
    
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date lastEditDate; 
    
    @OneToOne(cascade={CascadeType.ALL}, orphanRemoval=true)
    private EventTimeEntity when;
    
    //@OneToMany(cascade = {CascadeType.ALL}, orphanRemoval=true, mappedBy = "event")
    //private List<EventTimeEntity> operatingHours = new ArrayList<EventTimeEntity>();
  
    @OneToOne(cascade = {CascadeType.ALL}, orphanRemoval=true)
    private Ticket ticket;

    public EventEntity() {
        //  super();
    }
    
    public EventEntity(EventEntity e){
        super();
        this.eventName = e.getEventName();
        this.eventDesc = e.getEventDesc();
        this.eventUrl = e.getEventUrl();
       
        
    }
    public EventEntity(String eventName, String desc, String url){
        this.eventName = eventName;
        this.eventDesc = desc;
        this.eventUrl = url;
        
    }
    
    public EventEntity(String eventName, String desc, String url, ActivityOrganiserEntity organiser, ActivityAddressEntity addr, Ticket ticket){
        this.eventName = eventName;
        this.eventDesc = desc;
        this.eventUrl = url;
        this.ticket = ticket;
        this.setVenue(addr);
        this.setOrganiser(organiser);
    }
    
    
    public EventEntity(String eventName, String desc, String url, ActivityOrganiserEntity organiser, ActivityAddressEntity addr,
            ActivityType activityType, EventTimeEntity when, Ticket ticket){
        this.eventName = eventName;
        this.eventDesc = desc;
        this.eventUrl = url;
        this.ticket = ticket;
        this.setActivityType(activityType);
        this.setWhen(when);
        this.setVenue(addr);
        this.setOrganiser(organiser);
    }

    
    /**
     * @return the eventName
     */
    public String getEventName() {
        return eventName;
    }

    /**
     * @param eventName the eventName to set
     */
    public void setEventName(String eventName) {
        this.eventName = eventName;
    }

    /**
     * @return the eventDesc
     */
    public String getEventDesc() {
        return eventDesc;
    }

    /**
     * @param eventDesc the eventDesc to set
     */
    public void setEventDesc(String eventDesc) {
        this.eventDesc = eventDesc;
    }

    /**
     * @return the eventUrl
     */
    public String getEventUrl() {
        return eventUrl;
    }

    /**
     * @param eventUrl the eventUrl to set
     */
    public void setEventUrl(String eventUrl) {
        this.eventUrl = eventUrl;
    }
    
    /**
     * @return the creationDate
     */
    public Date getCreationDate() {
        return creationDate;
    }

    /**
     * @param creationDate the creationDate to set
     */
    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    /**
     * @return the lastEditDate
     */
    public Date getLastEditDate() {
        return lastEditDate;
    }

    /**
     * @param lastEditDate the lastEditDate to set
     */
    public void setLastEditDate(Date lastEditDate) {
        this.lastEditDate = lastEditDate;
    }

    /**
     * @return the ticket
     */
    public Ticket getTicket() {
        return ticket;
    }

    /**
     * @param ticket the ticket to set
     */
    public void setTicket(Ticket ticket) {
        this.ticket = ticket;
    }

    /**
     * @return the when
     */
    public EventTimeEntity getWhen() {
        return when;
    }

    /**
     * @param when the when to set
     */
    public void setWhen(EventTimeEntity when) {
        this.when = when;
    }

   

  
    
}
